import * as client from './client'
import urlConfig from './urlConfig'
///快捷下单
/**
 * 请求参数
 */
export class OrderRst {
    /* {
    "userUID": "0316249d-4efd-473e-8af6-48615ac8a46d",
    "storeUID": "2e47afc3-819f-403b-98ac-108d761ec61f",
    "salesOutletUID": "15ec02d1-906e-42d4-bbf7-44b201bb6bc0",
    "amount": 4.0,
    "noDiscountPrice": 5.0,
    "totalPrice": 6.0,
    "remark": "sample string 7"
    } */
    /**
     * 订单信息
     */
    public userUID: string;
    public storeUID: string;
    public salesOutletUID: string;
    public amount: number;
    public noDiscountPrice: number;
    public totalPrice: number;
    public remark: string;
    public clientSource: number;
    public voucherUID:string;
    public voucherAmount:number;
    public voucherType:number;

    
}
/**
 * 返回数据
 */
export class OrderRpn {
    /* {
    "isSuccess": 1,
    "code": "sample string 2",
    "description": "sample string 3",
    "resData": "7d2e1f8c-9741-4682-b5f6-12f919e5bcc0"
    } */
    public isSuccess: number;
    //状态码？
    public code: string;
    //描述
    public description: string;
    //返回数据
    public resData: string;
}

/**
 * 获取数据
 * @param rst 参数
 */
export async function exec(rst: OrderRst,userInfo:any) {
    const data = await client.exec(urlConfig.order, rst,userInfo);
    //return JSON.parse(data) as client.RSM<OrderRpn>;
    return JSON.parse(data) as OrderRpn;
}
